package com.ihr360.commons.model.meta;

import com.ihr360.commons.model.ICodedEntity;
import com.ihr360.commons.model.INamedEntity;
import com.ihr360.commons.model.entity.NumberIdWithTime;
import com.ihr360.commons.model.type.RoundType;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.MappedSuperclass;

@MappedSuperclass
public class AbstractPropertyMeta extends NumberIdWithTime<Long> implements ICodedEntity, INamedEntity {
    private static final long serialVersionUID = 3256213047719477309L;
    @Column(
            length = 32,
            nullable = false,
            unique = true
    )
    protected String code;
    @Column(
            length = 50,
            nullable = false
    )
    protected String name;
    @Column(
            length = 100
    )
    protected String engName;
    @Column(
            length = 100,
            nullable = false
    )
    protected Class<?> type;
    @Column(
            length = 50
    )
    protected String propName;
    protected boolean nullable = true;
    @Column(
            name = "unique_col"
    )
    protected boolean unique;
    protected int minLength;
    protected int maxLength = Integer.MAX_VALUE;
    protected long min;
    protected long max = Long.MAX_VALUE;
    @Column(
            name = "precision_col"
    )
    protected int precision = 2;
    @Column(
            length = 20
    )
    @Enumerated(EnumType.STRING)
    protected RoundType roundType;
    protected boolean editable = true;
    protected boolean updatable = true;
    protected boolean visible = true;

    public AbstractPropertyMeta() {
    }

    public Class<?> getType() {
        return this.type;
    }

    public void setType(Class<?> type) {
        this.type = type;
    }

    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEngName() {
        return this.engName;
    }

    public void setEngName(String engName) {
        this.engName = engName;
    }

    public boolean isNullable() {
        return this.nullable;
    }

    public void setNullable(boolean nullable) {
        this.nullable = nullable;
    }

    public boolean isUnique() {
        return this.unique;
    }

    public void setUnique(boolean unique) {
        this.unique = unique;
    }

    public int getMinLength() {
        return this.minLength;
    }

    public void setMinLength(int minLength) {
        this.minLength = minLength;
    }

    public int getMaxLength() {
        return this.maxLength;
    }

    public void setMaxLength(int maxLength) {
        this.maxLength = maxLength;
    }

    public long getMin() {
        return this.min;
    }

    public void setMin(long min) {
        this.min = min;
    }

    public long getMax() {
        return this.max;
    }

    public void setMax(long max) {
        this.max = max;
    }

    public int getPrecision() {
        return this.precision;
    }

    public void setPrecision(int precision) {
        this.precision = precision;
    }

    public RoundType getRoundType() {
        return this.roundType;
    }

    public void setRoundType(RoundType roundType) {
        this.roundType = roundType;
    }

    public boolean isEditable() {
        return this.editable;
    }

    public void setEditable(boolean editable) {
        this.editable = editable;
    }

    public boolean isUpdatable() {
        return this.updatable;
    }

    public void setUpdatable(boolean updatable) {
        this.updatable = updatable;
    }

    public boolean isVisible() {
        return this.visible;
    }

    public void setVisible(boolean visible) {
        this.visible = visible;
    }

    public String getPropName() {
        return this.propName;
    }

    public void setPropName(String propName) {
        this.propName = propName;
    }
}